package wxapp

import (
	"context"
	v1 "hotgo/api/api/wxapp/v1"
	"hotgo/internal/service"
)

// ActivityList 活动列表
func (c *ControllerV1) ActivityList(ctx context.Context, req *v1.ActivityListReq) (res *v1.ActivityListRes, err error) {
	res = &v1.ActivityListRes{}
	res.List, res.TotalCount, err = service.Wxapp().ActivityList(ctx, req.Page, req.PageSize)
	return
}

// ActivityDetail 活动详情
func (c *ControllerV1) ActivityDetail(ctx context.Context, req *v1.ActivityDetailReq) (res *v1.ActivityDetailRes, err error) {
	res = &v1.ActivityDetailRes{}
	res.Activity, err = service.Wxapp().ActivityDetail(ctx, req.Id)
	return
}

// GetVideo 下载视频列表
func (c *ControllerV1) GetVideo(ctx context.Context, req *v1.GetVideoReq) (res *v1.GetVideoRes, err error) {
	res = &v1.GetVideoRes{}
	list, err := service.Wxapp().GetVideo(ctx, req.ActivityId, req.IdCard)
	if err != nil {
		return
	}
	res.List = &list
	return
}

// CreateOrder 创建订单
func (c *ControllerV1) CreateOrder(ctx context.Context, req *v1.CreateOrderReq) (res *v1.CreateOrderRes, err error) {
	res = &v1.CreateOrderRes{}
	res.OrderId, res.OrderNum, err = service.Wxapp().CreateOrder(ctx, req.VideoId)
	return
}
